(ns util.mon.windows
  (:require util.pdh
            util.pdh2
            jna.win.psapi))


(defn pdh-get-process-memory [pid]
  {:vm (util.pdh/pdh-private-bytes (util.pdh/pdh-process-instance pid))
   :memory (util.pdh/pdh-working-set-private (util.pdh/pdh-process-instance pid))})


(defn with-pdh-box-fn [f]
  (util.pdh2/with-pdh-box
     (util.pdh/pdh-with-pid-cache
       (f))))


(def pdh-update jna.win.pdh/pdh-collect-all)

(defn winapi-get-process-memory [pid]
  {:vm (:vm (jna.win.psapi/get-process-memory pid))
   :memory (:private (jna.win.psapi/get-process-working-set pid))})

